﻿Option Explicit On
Option Strict On

Imports System
Imports System.Collections.Generic
Imports System.Xml.Linq
Imports System.Linq
Imports GenDotNet.ObjectModel
Imports <xmlns:orm="http://kadgen.com/KADORM.xsd">
Imports <xmlns:kd="http://kadgen.com/Special.xsd">

Namespace GenInputMetadata
   Public Class CriterionData
      Inherits BaseData
      Implements ICriterionData


      Private mCriteriaData As ICriteriaData

      Public Shared Function Load(ByVal criteriaData As CriteriaData, ByVal element As XElement) As CriterionData
         Dim ret = New CriterionData(criteriaData.rootdata, element)
         ret.mCriteriaData = criteriaData
         Return ret
      End Function

      Public Shared Function Load( _
                 ByVal criteriaData As CriteriaData, _
                 ByVal elements As IEnumerable(Of XElement)) _
                 As List(Of ICriterionData)
         Dim ret = New List(Of ICriterionData)
         For Each XElement In elements
            ret.Add(Load(criteriaData, XElement))
         Next
         Return ret
      End Function

      Private Sub New(ByVal rootData As RootData, _
                      ByVal element As XElement)
         MyBase.New(rootData, element)
      End Sub

      Public ReadOnly Property CriteriaData() As ICriteriaData
         Get
            Return Me.mCriteriaData
         End Get
      End Property

      Public ReadOnly Property Name() As String Implements ICriterionData.Name
         Get
            Return Element.@Name
         End Get
      End Property

      Public ReadOnly Property NetType() As StandardNetType Implements ICriterionData.NetType
         Get
            Return NetTypeExtensions.XsdToNetType(Element.@NETType)
         End Get
      End Property
   End Class
End Namespace